package com.roger.myHome.controller;

import com.roger.myHome.domain.TbUsers;
import com.roger.myHome.service.CacheService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/cache")
public class CacheController {

    @Resource
    private CacheService cacheService;

    @GetMapping("/findById/{id}")
    public TbUsers findById(@PathVariable long id){
        return cacheService.findById(id);
    }

    @GetMapping("/userList/{id}")
    public List userList(@PathVariable Integer id){
        return cacheService.queryUserList(id);
    }

}
